package cn.doit.scala.day03

import cn.doit.scala.day03.beans.Teachers

/**
 * @DATE 2021/12/27/17:38
 * @Author MDK
 * @Version 2021.2.2
 * */
object C13_Sorted05 {
  def main(args: Array[String]): Unit = {
    val list: List[Teachers] = List[Teachers](
      Teachers(1, "lny", 42, 61.0),
      Teachers(2, "ly", 43, 61.0),
      Teachers(3, "laona", 38, 60.0),
      Teachers(4, "taoge", 44, 99.0),
      Teachers(5, "星哥", 28, 33.0)
    )
    val res: List[Teachers] = list.sorted
    res.foreach(println)
    println("-----------------------------------")
    val list1 = list.sortWith((t1, t2) => t1.age > t2.age)
    list1.foreach(println)
  }
}
